<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>{:session('cp.cpsysname')}--商户管理平台</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="{:config('webconfig.description');}">
    <meta name="keywords" content="{:config('webconfig.keywords');}">
    <meta name="author" content="runoob">
    <link rel="stylesheet" href="__STATIC_URL__/static/css/bootstrap.css">
    <link rel="stylesheet" type="text/css" href="__STATIC_URL__/static/css/bootstrap-datetimepicker.css"/>
    <link rel="stylesheet" type="text/css" href="__STATIC_URL__/static/css/index.css"/>
    <link rel="stylesheet" type="text/css" href="__STATIC_URL__/static/css/Statistics.css"/>
    <script src="__STATIC_URL__/static/js/jquery-2.1.4.min.js"></script>
    <script src="__STATIC_URL__/static/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <script src="__STATIC_URL__/static/layer/3.0.3/layer.js"></script>
    <script src="__STATIC_URL__/static/js/commen.js"></script>
    <style type="text/css">
        .red {
            color: #FF6667;
        }

        .green {
            color: #66CC99;
        }

        .persont {
            font-size: 12px;
        }

        .card-box {
            height: 153px;

        }
        .table th, .table td {
            word-break: break-all;
        }
    </style>
</head>
<body>
{include file='public/header'/}
<section>
    <!------------------导航-------------------------->
    {include file='public/left'/}
    <!--------------------------主要内容区域------------------------------------->
    <div class="content">
        <div class="page-heading mgl15 mgr15">
            <ol class="breadcrumb">
                <li>当前位置是&nbsp;:</li>
                <li>
                    <a href="#">交易中心</a>
                </li>
                <li class="active">交易统计</li>
            </ol>
        </div>
        <div class="mgl15 mgr15">
            <div class="panel panel-default panel-search">
                <div class="panel-heading">
                    <h5 class="panel-title"><span class="glyphicon glyphicon-search pull-left"
                                                  style="margin-right: 10px;"></span>条件筛选</h5>
                </div>
                <div class="panel-body">
                    <form action="" class="form-horizontal table-search form-search" role="form" id="frm">
                        <div class="col-sm-6  col-lg-4 ">
                            <div class="form-group">
                                <label class="col-sm-3 control-label">门店：</label>
                                <div class="col-sm-9">
                                    <select name="machname" class="form-control">
                                        {if condition="get_mid_num() neq '1'"}
                                        <option value="">所有门店</option>
                                        {/if}
                                        {volist name="machlist" id="search"}
                                        <option value="{$search.merchant}" {if
                                                condition="$p_data['machname'] eq $search.merchant" }selected{
                                        /if}>{$search.merchant}</option>
                                        {/volist}
                                    </select>
                                </div>
                            </div>
                        </div>
                        <div class="col-sm-6  col-lg-4 col-slg-4">
                            <div class="form-group">
                                <label class="col-sm-3 control-label">时间：</label>
                                <div class="col-sm-9">
                                    <div class="input-group">

                                        <input name="search_date" type="text" value="{$p_data['search_date']}"
                                               readonly="readonly" id="search_date" class="form-control"
                                               placeholder="请选择" style="width: 400px">
                                    </div>
                                </div>
                            </div>
                        </div>
                    </form>
                </div>

                <div class="panel-footer">
                    <a href="javascript:;" class="btn btn-primary" onclick="searchform()">查找</a>
                    <a href="javascript:;" class="btn btn-default" onclick="clearform()">清空</a>
                </div>
            </div>
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h5 class="panel-title">
                        交易方式统计
                    </h5>
                </div>
                <div class="panel-body">
                    <table class="table">
                        <thead>
                        <tr bgcolor="#eee">
                            <th>支付方式</th>
                            <th>订单笔数</th>
                            <th>应收合计</th>
                            <th>折扣金额</th>
                            <th>实收合计</th>

                            <th>退款金额</th>

                        </tr>
                        </thead>
                        <tbody id="infos">

                        </tbody>
                    </table>
                </div>
            </div>

        </div>

        {include file='public/footer'/}
    </div>
</section>
</body>
<script src="__STATIC_URL__/static/js/commen.js" type="text/javascript" charset="utf-8"></script>
<script src="__STATIC_URL__/static/laydate/laydate.js"></script>
<script>
    function searchform(){

        getinfo();

    }
    //执行一个laydate实例
    // var s=laydate.now();
    laydate.render({
        elem: '#search_date',
        type: 'datetime',
        range: true,
        done: function (value, date, date2, data3) {
            var s = value.split(" - ");
            var startdate = new Date(s[0]).getTime();
            var enddate = new Date(s[1]).getTime();
            var ldate = Math.floor((enddate - startdate) / (24 * 3600 * 1000));
            if (ldate > 30) {
                alert("日期区间不能大于30天");
            }
        }
    });
    $(function () {
        getinfo();
    });

    function getinfo() {
        var index = layer.load(0, {
            shade: [0.1,'#fff'] //0.1透明度的白色背景
        });
        $('#infos').html("");
        $.ajax({
            url: "{:url('pay/paychannel')}",
            data: $('#frm').serialize(),
            dataType: "json",
            type: "post",
            success: function (res) {
               layer.close(index);
                var html = '<tr>' +
                    '<td>' + '微信支付' + '</td>' +
                    '<td>' + res.wx_order + '</td>' +
                    '<td>' + res.wx_yf_fee + '</td>' +
                    '<td>' + res.wx_zk_fee + '</td>' +
                    '<td>' + res.wx_fee + '</td>' +
                    '<td>' + res.wx_refund_fee + '</td>' +


                    '</tr>' +
                    '<tr>' +
                    '<td>' + '微信刷卡支付' + '</td>' +
                    '<td>' + res.wx_barcode_order + '</td>' +
                    '<td>' + res.wx_barcode_yf_fee + '</td>' +
                    '<td>' + res.wx_barcode_zk_fee + '</td>' +
                    '<td>' + res.wx_barcode_fee + '</td>' +
                    '<td>' + res.wx_barcode_refund_fee + '</td>' +


                    '</tr>'+
                    '<tr>' +
                    '<td>' + '支付宝支付' + '</td>' +
                    '<td>' + res.ali_order + '</td>' +
                    '<td>' + res.ali_yf_fee + '</td>' +
                    '<td>' + res.ali_zk_fee + '</td>' +

                    '<td>' + res.ali_fee + '</td>' +
                    '<td>' + res.ali_refund_fee + '</td>' +


                    '</tr>' +
                    '<tr > ' +
                    '<td>' + '支付宝刷卡支付' + '</td>' +
                    '<td>' + res.ali_barcode_order + '</td>' +

                    '<td>' + res.ali_barcode_yf_fee + '</td>' +
                    '<td>' + res.ali_barcode_zk_fee + '</td>' +
                    '<td>' + res.ali_barcode_fee + '</td>' +
                    '<td>' + res.ali_barcode_refund_fee + '</td>' +


                    '</tr>'+
                    '<tr>' +
                    '<td>' + '微信会员卡支付' + '</td>' +
                    '<td>' + res.wx_card_order + '</td>' +
                    '<td>' + res.wx_card_yf_fee + '</td>' +
                    '<td>' + res.wx_card_zk_fee + '</td>' +
                    '<td>' + res.wx_card_fee + '</td>' +
                    '<td>' + res.wx_card_refund_fee + '</td>' +


                    '</tr>' +
                    '<tr>' +
                    '<td>' + '现金支付' + '</td>' +
                    '<td>' + res.cash_order + '</td>' +
                    '<td>' + res.cash_yf_fee + '</td>' +
                    '<td>' + res.cash_zk_fee + '</td>' +
                    '<td>' + res.cash_fee + '</td>' +
                    '<td>' + res.cash_refund_fee + '</td>' +

                    '</tr>'+
                    '</tr>' +

                    '<tr bgcolor="#eee">' +
                    '<td>' + '合计' + '</td>' +
                    '<td>' + res.z_order + '</td>' +
                    '<td>' + res.z_yf_fee + '</td>' +
                    '<td>' + res.z_zk_fee + '</td>' +
                    '<td>' + res.z_fee + '</td>' +
                    '<td>' + res.z_refund_fee + '</td>' +

                    '</tr>'
                ;

                $('#infos').html(html);
            }


        })


    }
</script>
</html>
